<?php
	require_once('simpletest\autorun.php');
	
	SimpleTest :: prefer(new TextReporter());
	require_once('reader.php');

	class suiteTest extends UnitTestCase {
		function testCreateObject() {
			$this->assertTrue(new Reader($argv));
		}
		
		function testObjectGetsArgsValues() {
			$argv = 'toolkit.php --pages=test1.html;test2.html --tests=ValidHTML;ValidCSS --testType=1 --returnType=2';
			$arguments = new Reader($argv);
			$this->assertEqual($arguments, $argv);
		}
		
		function testObjectGetsCallingFile() {
			$argv = 'toolkit.php --pages=test1.html;test2.html --tests=ValidHTML;ValidCSS --testType=1 --returnType=2';
			
			$arguments = new Reader($argv);
			
			$this->assertEqual($arguments->caller, 'toolkit.php');
		}
		
		function testObjectReturnsParams() {
			$argv = 'toolkit.php --pages=test1.html;test2.html --tests=ValidHTML;ValidCSS --testType=1 --returnType=2';
			
			$arguments = new Reader($argv);
			
			$arguments = $arguments->toArray();
			
			$this->assertEqual($arguments['pages'], array('test1.html', 'test2.html'));
			$this->assertEqual($arguments['tests'], array('ValidHTML', 'ValidCSS'));
			$this->assertEqual($arguments['testType'], '1');
			$this->assertEqual($arguments['returnType'], '2');
			
		}
		
		function testObjectReturnsParamKeys() {
			$argv = 'toolkit.php --pages=test1.html;test2.html --tests=ValidHTML;ValidCSS --testType=1 --returnType=2';
			
			$arguments = new Reader($argv);
			
			$arguments = $arguments->toArray();
			
			$keys = array_keys($arguments);

			$this->assertEqual($keys[0], 'pages');
			$this->assertEqual($keys[1], 'tests');
			$this->assertEqual($keys[2], 'testType');
			$this->assertEqual($keys[3], 'returnType');
		}
		
		function testObjectReturnsParamValues() {
			$argv = 'toolkit.php --pages=test1.html;test2.html --tests=ValidHTML;ValidCSS --testType=1 --returnType=2';
			
			$arguments = new Reader($argv);
			
			$arguments = $arguments->toArray();
			
			$this->assertEqual($arguments['pages'][0], 'test1.html');
			$this->assertEqual($arguments['pages'][1], 'test2.html');
			$this->assertEqual($arguments['tests'][0], 'ValidHTML');
			$this->assertEqual($arguments['tests'][1], 'ValidCSS');
			$this->assertEqual($arguments['testType'], '1');
			$this->assertEqual($arguments['returnType'], '2');
			
		}
	}
?>